package Cn.Sarkar.MMS.DataBaseDefinations.Independent

import Cn.Sarkar.EntityDream.CoreEngine.RDBMS.Core.Extensions.*
import Cn.Sarkar.MMS.DataBaseDefinations.Independent.Wallet.Wallets
import Cn.Sarkar.Entities.Common.TableNoID

object DomainRelations : TableNoID("DomainRelations") {
    override var Comment: String = "ئەپ ۋە ئەپ تەسىر دائىرىسى ۋە ھىسابات ۋە چىقىمدان ئۇلانمىسى"
    val ApplicationID = intColumn("ApplicationID") reference Applications.ID comment "ئەپ"
    val AccountID = intColumn("AccountID") reference Accounts.ID comment "ھىسابات"
    val WalletID = intColumn("WalletID") reference Wallets.ID comment "چىقىمدان"
    val ApplicationDomainID = intColumn("ApplicationDomainID") reference ApplicationDomains.ID comment "ئەپ مىقياسى"
    val CustomerCompanyID = intColumn("CustomerCompanyID") reference Companies.ID comment "شىركەت ياكى ئورۇن"

    init {
        primaryKey(ApplicationID, ApplicationDomainID, AccountID)
        index(WalletID) unique true
    }

    override val CATEGORY: Int = 10
}